package com.um.jdy.platform.station.controller;
import com.um.jdy.platform.station.entity.dto.FeeEbDTO;
import com.um.jdy.platform.station.entity.vo.FeeEbVO;
import com.um.jdy.platform.station.manager.*;
import com.um.springboot.starter.annotation.ApiPermission;
import com.um.springboot.starter.annotation.TokenRequired;
import com.um.springboot.starter.orm.controller.BaseController;
import com.um.springboot.starter.orm.entity.Response;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;


/**
 * 方案管理
 *
 * @author cs
 * 日期 2023/5/25
 * 版权所有 广州优匠科技有限公司
 */
@Api(tags = "方案管理-单车方案")
@Validated
@RestController
@RequestMapping("/api/v1/cms/fee/eb")
@ApiPermission("fee_eb")
@TokenRequired
public class FeeEbController extends BaseController<FeeEbManager> {

    @ApiOperation(value = "详情")
    @GetMapping("/{id}")
    public Response<FeeEbVO> get(@ApiParam(value = "方案id") @PathVariable String id) {
        return Response.success(manager.get(id));
    }

    @ApiOperation(value = "新增")
    @PostMapping("")
    public Response add(@RequestBody FeeEbDTO feeEbDTO) {
        return Response.success(manager.add(feeEbDTO));
    }

    @ApiOperation(value = "编辑")
    @PutMapping("/{id}")
    public Response update(@ApiParam(value = "方案id") @PathVariable String id,
                                    @RequestBody FeeEbDTO feeEbDTO) {
        return Response.success(manager.update(id, feeEbDTO));
    }
}
